﻿using System;
using System.Web;
using System.Web.Routing;
using System.Web.Mvc;
using PhotoGallery.Infrastructure.Modules;

namespace PhotoGallery.Modules
{
    public class HomeModule : IModule
    {
        private readonly string[] controllerNamespaces;

        public HomeModule()
        {
            this.controllerNamespaces = new String[] { "PhotoGallery.Modules.Home.Controllers" };
        }

        #region IModule Members

        public void Initialize()
        {
        }

        public void Unload()
        {
        }

        public void RegisterRoutes(RouteCollection routes)
        {           
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
                new { controller = "(Home)", action = "(Index|Operation|Edit|Save|SearchLocation|SearchLeader|Add|Detail|Upload|Delete|Image|DownLoad|Search|Authority|SaveAuthority)" },
                controllerNamespaces
            );

        }

        public void RegisterModelBinders(ModelBinderDictionary binders)
        {
        }

        #endregion
    }
}
